package com.seres.data;

import com.seres.backend.GameState;
import com.seres.events.GameStateEvent;
import com.seres.general.EventBroker;

public abstract class Module {
	private int moduleId;
	private ModuleType moduleType;
	private boolean finished;
	private String title;
	
	Module(){
		
	}
	public Module(ModuleType moduleType, String title){
		setModuleType(moduleType);
	}
	
	//wat met deze functie? overbodig? --> 16/7/2012: niet overbodig, wordt gebruikt bij bepalen game logica
	public boolean hasBeenFinished(){
		return finished;
	}

	public void finishModule(){
		setFinished(true);
		EventBroker.getEventBroker().fireGameStateEvent(new GameStateEvent(GameState.END_OF_MODULE));
	}
	
	public void setModuleId(int moduleId) {
		this.moduleId = moduleId;
	}

	public int getModuleId() {
		return moduleId;
	}

	public void setModuleType(ModuleType moduleType) {
		this.moduleType = moduleType;
	}

	public ModuleType getModuleType() {
		return moduleType;
	}
	public abstract boolean isOfType(ModuleType moduleType);

	private void setFinished(boolean finished) {
		this.finished = finished;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getTitle() {
		return title;
	}
}
